<template>
  <div class="con">
    <div
      class="btn"
      v-for="(item,index) in gzpdata"
      :key="index"
      @click="handel(item)"
      :class="{active:item.active}"
    >{{item.deviceName}}</div>
    <el-dialog
      :title="PopUpdata.deviceName+setPopUpTitle+'历史记录'"
      :visible.sync="dialogVisible"
      width="70%"
      :before-close="handleClose"
    >
      <PopUp :PopUpdata="PopUpdata" @Title="Title" v-if="dialogVisible" />
      <iframe class="iframe" frameborder="0"></iframe>
    </el-dialog>
  </div>
</template>

<script lang="ts">
import { Component, Vue, Prop } from "vue-property-decorator";
import PopUp from "./PopUp.vue";
import date from "@/utils/date";
import { GetSocketModule } from "@/store/modules/GetSocketData";
@Component({
  components: { PopUp },
})
export default class extends Vue {
  @Prop() gzpdata!: any[];
  PopUpdata = {};
  PopUpTitle = "";
  get setPopUpTitle() {
    return this.PopUpTitle;
  }
  public gzp = [
    // {
    //   name: "机械特性",
    //   active: false,
    //   id: "0",
    // },
    // {
    //   name: "光纤测温",
    //   active: false,
    //   id: "1",
    // },
    // {
    //   name: "变压器局放",
    //   active: false,
    //   id: "2",
    // },
    // {
    //   name: "GIS局放",
    //   active: false,
    //   id: "3",
    // },
    // {
    //   name: "套管介损",
    //   active: false,
    //   id: "4",
    // },
    // {
    //   name: "声纹振动",
    //   active: false,
    //   id: "5",
    // },
    // {
    //   name: "油色谱",
    //   active: false,
    //   id: "6",
    // },
    // {
    //   name: "有载分接开关",
    //   active: false,
    //   id: "7",
    // },
    // {
    //   name: "铁心/夹件接开关",
    //   active: false,
    //   id: "8",
    // },
  ];
  //弹框状态
  dialogVisible = false;
  handleClose() {
    this.dialogVisible = false;
    this.PopUpTitle = "";
  }
  handel(item) {
    this.gzp.map((item) => {
      item.active = false;
    });
    this.dialogVisible = true;
    this.PopUpdata = item;
  }
  Title(val) {
    this.PopUpTitle = val;
  }

  mounted() {
    // console.log(this.gzpdata);

    // console.log(GetSocketModule.AllAuxiliaryByDeviceId);
  }
}
</script>
<style lang="scss" scoped>
.con {
  width: 100%;
  height: calc(100% - 0.27rem);
  padding: 0.1rem 0.15rem 0.05rem;
  box-sizing: border-box;
  overflow-y: auto;
  .btn {
    height: calc(11.11% - 0.05rem);
    width: 100%;
    border: 2px solid #1489c9;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: rgba(29, 103, 103, 0.4);
    margin-bottom: 0.05rem;
    font-size: 0.18rem;
    cursor: pointer;
  }
  .active {
    background: linear-gradient(to top, #b22222, #dc143c);
  }
  .iframe {
    width: 100vw;
    height: 100vh;
    position: fixed;
    top: 0px;
    left: 0px;
    z-index: 1;
    opacity: 0.1;
    background: none;
    pointer-events: none;
  }
}
</style>
<style lang="scss" >
.con {
  .el-dialog__body {
    height: 5.5rem;
  }
}
</style>

